
<script type="text/javascript">
var swfu1_
$(function(){
	var btn1 = $("#upbtn1").get(0);
    swfu1_= new SWFUpload({
    			upload_url: "/upload/upload",
                file_post_name: "filedata",
				file_size_limit : "1 MB",
				file_types : "*.jpg;*.png;*.jpeg'*.bmp",
				file_types_description : "bmp,jpeg,jpg,png图片",
				file_upload_limit :5,
				post_params : {
		           "bizType" : "GOODS",
		           "fileType" : "IMAGE",
		           "fileName" : ""
			    },
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : function(f,data){
					eval("var json="+data+";");
					if(json.message=="Success!"){
						var htmstr="";
						htmstr+="<div style='float:left;'>";
						htmstr+='<input type="hidden" name="medias" value="'+json.data.urls+'">';
						htmstr+='<img height="200px"src="'+json.data.urls+'"/>';
						htmstr+='<br/><a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();"><b>删除</b></a>';
						htmstr+='</div>';
						$("#img_div1").append(htmstr);
					}else{
						$.messager.alert('警告','文件上传出错');
					}
				},
				upload_complete_handler : uploadComplete,
				// Button Settings
				button_placeholder_id:"upbtn1",
				button_image_url : "/img/SmallSpyGlassWithTransperancy_17x18.png",
				button_width: 80,
				button_height: 18,
				button_text : '<span class="button">上传商品图片</span>',
				button_text_style : '.button {font-size: 12pt; }',
				button_text_top_padding: 0,
				button_text_left_padding: 18,
				button_disabled : false,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				// Flash Settings
				flash_url : swfuploaddir+"/swfupload.swf",
				flash9_url : swfuploaddir+"/swfupload_fp9.swf",
				custom_settings : {
				//	upload_target : "divFileProgressContainer",
					thumbnail_height: 500,
					thumbnail_width: 500,
					thumbnail_quality: 100
				},
				debug: true
			});
});
</script>

<script type="text/javascript">
var swfu_
$(function(){
	/* var btn = $("#upbtn").get(0);
    swfu_= new SWFUpload({
    			upload_url: "/upload/upload",
                file_post_name: "filedata",
				file_size_limit : "1 MB",
				file_types : "*.jpg;*.png;*.jpeg'*.bmp",
				file_types_description : "bmp,jpeg,jpg,png图片",
				file_upload_limit :5,
				post_params : {
		           "bizType" : "GOODS",
		           "fileType" : "IMAGE",
		           "fileName" : ""
			    },
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : function(f,data){
					eval("var json="+data+";");
					if(json.message=="Success!"){
						var htmstr="";
						htmstr+="<div style='float:left;'>";
						htmstr+='<input type="hidden" name="goods.icon" value="'+json.data.urls+'">';
						htmstr+='<img height="200px"src="'+json.data.urls+'"/>';
						htmstr+='<br/><a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();"><b>删除</b></a>';
						htmstr+='</div>';
						$("#img_div").append(htmstr);
					}else{
						$.messager.alert('警告','文件上传出错');
					}
				},
				upload_complete_handler : uploadComplete,
				// Button Settings
				button_placeholder_id:"upbtn",
				button_image_url : "/img/SmallSpyGlassWithTransperancy_17x18.png",
				button_width: 80,
				button_height: 18,
				button_text : '<span class="button">上传商品图片</span>',
				button_text_style : '.button {font-size: 12pt; }',
				button_text_top_padding: 0,
				button_text_left_padding: 18,
				button_disabled : false,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				// Flash Settings
				flash_url : swfuploaddir+"/swfupload.swf",
				flash9_url : swfuploaddir+"/swfupload_fp9.swf",
				custom_settings : {
				//	upload_target : "divFileProgressContainer",
					thumbnail_height: 500,
					thumbnail_width: 500,
					thumbnail_quality: 100
				},
				debug: true
			}); */
    
			 $("#edit_mgCatId").combobox({
				url: '/category/combobox',    
				valueField:'id',    
			    textField:'name',
			    editable:false,
			    required: true,
			    width:150
			});
    
		    $("#edit_sgCatId").combobox({
				url: '/goodsCategory/comboboxShopCategory/'+${(po.shop_id)!0},    
				valueField:'id',    
			    textField:'name',
			    editable:false,
			    required: true,
			    width:150
			});	
		    
		    $('#edit_shopId').combobox({    
		    	url: '/shop/combobox',   
			    valueField:'id',    
			    textField:'name',
			    editable:false,
			    required: true,
			    width:122,
			    onSelect:function(record){  
			    	$("#edit_sgCatId").combobox({
			    		url: '/goodsCategory/comboboxShopCategory/' + record.id,    
			    		valueField:'id',    
					    textField:'name',
					    editable:false,
		    		    required: true
		    		})
		    	}
		    });
		    
		    $("#edit_unitId").combobox({
				url: '/goodsUnit/combobox',    
				valueField:'id',    
			    textField:'name',
			    editable:false,
			    required: true,
			    width:150
			});	
		});
		
</script>
<form method="post" id="editForm" name="editForm">
	<input type="hidden" name="goods.id" value="${(po.id)!}" id="poid">
	<div id="tt" class="easyui-tabs" style="width: 786px; height: 450px;">
		<div title="商品信息" style="padding: 5px;">
			<table class="tableForm tableCss">
				<#if po??>
				<tr>
					<th>商品编号</th>
					<td colspan="3">
						${(po.goods_no)!}
						<input type="hidden" name="goods.goods_no" value="${(po.goods_no)!}">
					</td>
				</tr>
				</#if>
				<tr>
					<th>所属市场公共分类</th>
					<td colspan="3">
						<input id="edit_mgCatId" name="goods.mg_cat_id" value="${(po.mg_cat_id)!}">
					</td>
				</tr>
				<tr>
					<th>所属商铺</th>
					<td colspan="1">
						<input id="edit_shopId" name="goods.shop_id" value="${(po.shop_id)!}"> 
					</td>
					<th><font color=red>*</font>所属分类</th>
					<td><input id="edit_sgCatId" name="goods.sg_cat_id" value="${(po.sg_cat_id)!}"></td>
				</tr>
				<!-- <tr>
					<th><font color=red>*</font>分类别名</th>
					<td><input id="edit_categoryAlias" name="goods.category_alias" value="${(po.category_alias)!}"></td>
				</tr> -->
				<tr>
					<th><font color=red>*</font>商品名称</th>
					<td colspan="3">
						<input type="text" name="goods.name" class="easyui-validatebox" 
						value="${(po.name)!}" data-options="required:true" style="width:360px;"/>
					</td>
				</tr>
				<!-- <tr>
					<th>商品单位</th>
					<td colspan="1">
						<input id="edit_unitId" name="goods.unit_id" value="${(po.unit_id)!}"/>
					</td>
				</tr> -->
				<tr>
					<th><font color=red>*</font>单位名称</th>
					<td colspan="1">
						<input type="hidden" name="goodsUnit.id" value="${(guPo.id)!}">
						<input type="text" name="goodsUnit.name" class="easyui-validatebox" 
						value="${(guPo.name)!}" data-options="required:true" style="width:60px;"/>
					</td>
					<th><font color=red>*</font>单位描述</th>
					<td>
						<input type="text" name="goodsUnit.summary" class="easyui-validatebox" 
						value="${(guPo.summary)!}" data-options="required:true"/>
					</td>
				</tr>
				<tr>
					<th><font color=red>*</font>单位数值</th>
					<td>
						<input type="text" name="goodsUnit.pcs" class="easyui-validatebox" 
						value="${(guPo.pcs)!}" data-options="required:true" style="width:60px;"/>
					</td>
					<th><font color=red>*</font>是否允许加入购物车</th><!-- 库存 -->
					<td>
						<input name="goods.stock" class="easyui-combobox" value="${(po.stock)!9999}"
						data-options="valueField: 'label',textField: 'value',
						data: [{label: '0',value: '否'},{label: '9999',value: '是'}]"  style="width:60px;" editable="false">
					</td>
				</tr>
				<tr>
					<th><font color=red>*</font>参考价格</th>
					<td>
						<input type="text" name="goods.init_price" class="easyui-validatebox" 
						value="${(po.init_price)!}" data-options="required:true" style="width:60px;" editable="false"/>  元
					</td>
					<th><font color=red>*</font>销售价格</th>
					<td>
						<input type="text" name="goods.sale_price" class="easyui-validatebox" 
						value="${(po.sale_price)!}" data-options="required:true" style="width:60px;"/>  元
					</td>
				</tr>
				<tr>
					<th>显示参考价格</th>
					<td colspan="1">
						<input name="goods.show_init_price" class="easyui-combobox" value="${(po.show_init_price)!'1'}"
						data-options="valueField: 'label',textField: 'value',
						data: [{label: '0',value: '不显示'},{label: '1',value: '显示'}]" editable="false">
					</td>
					<th>商品状态</th>
					<td colspan="1">
						<input name="goods.status" class="easyui-combobox" value="${(po.status)!'IN'}"
						data-options="valueField: 'label',textField: 'value',
						data: [{label: 'IN',value: '上架'},{label: 'OUT',value: '下架'}]" editable="false">
					</td>
				</tr>
				<tr>
					<th><font color=red>*</font>产地</th>
					<td colspan="3">
						<input type="text" name="goods.original" class="easyui-validatebox" 
						value="${(po.original)!}" style="width:200px;"/> 
					</td>
				</tr>
				<!-- <tr>
					<th><font color=red>*</font>商品列表显示图</th>
					<td>
						<div title="图片" style="padding:5px;">
							<div class="tableForm datagrid-toolbar" >
								<div style="width:60px;border:1px;">
									<span id="upbtn"></span>
								</div>
								<div id="img_div">
									<#if po?? && po.icon??>
									<div style='float:left;'>
										<input type="hidden" name="goods.icon" id="icon" value="${(po.icon)!}">
										<img src="${(po.icon)!}" height="100px"/>
										<br/>
										<a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();$('#icon').val('');"><b>删除</b></a>
									</div>
									</#if>
								</div>
							</div>
						</div>
					</td>
				</tr> -->
			</table>
		</div>
		<div title="商品介绍" style="padding:5px;">
			<table class="tableForm tableCss">
				<tr>
					<th><font color=red>*</font>商品描述</th>
					<td colspan="3">
						<textarea name="goods.summary" style="width:600px;height:80px;">${(po.summary)!}</textarea>
					</td>
				</tr>
				
				<tr>
					<th>商品图片</th>
					<td colspan="3">
						<input type="hidden" name="goods.icon" id="medias" value="${(po.icon)!}">
						
						<div title="图片" style="padding:5px;">
							<div class="tableForm datagrid-toolbar" >
								<div style="width:60px;border:1px;">
									<span id="upbtn1"></span>
								</div>
								
								<div id="img_div1" >
									<#if goodHeadMediaList??>
										<#list  goodHeadMediaList as x>
											<div style='float:left;'>
												<input type="hidden" name="medias" id="medias" value="${x.content}">
												<img src="${x.content}" height="200px"/>
												<br/>
												<a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();">删除</a>
											</div>
										</#list>
									</#if>
									<#if po?? && po.icon?? && goodHeadMediaList?size==0>
										<div style='float:left;'>
											<input type="hidden" name="medias" id="medias" value="${(po.icon)!}">
											<img src="${(po.icon)!}" height="200px"/>
											<br/>
											<a href="#" class="easyui-linkbutton" onclick="javascript:$(this).parent().remove();">删除</a>
										</div>
									</#if>
								</div>
								
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
</form>
